<?php
namespace Admin\Model;

/**
 * 商品类型
 */
class TypeModel extends CommonModel
{
	protected $_fields = ["id","type_name"];
	protected $_vaildata = [
		["type_name","require","类型名称必填"],
	];
	public function listdata(){
		$pageSize = 20;
		$count = $this->count();
		$Page = new \Think\Page($count,$pageSize);
		$show = $Page->show();
		$list = $this->order("id")->limit($Page->firstRow.",".$pageSize)->select();
		return ["pageStr"=>$show,"list"=>$list];
	}
	public function dels($id){
		return $this->where("id=".$id)->delete();
	}
	public function update($data){
		return $this->save($data);
	}
}